<style type="text/css">
  #selectSearch {position: absolute;left: 0;top: 0;height: 36px;line-height: 36px;width: 70px;overflow: hidden;box-sizing: border-box;background-color: #f2f2f2;}
  #selectSearch .after-content {position: absolute;right: 10px;top: 15px;width: 5px;height: 5px;border-top: 1px solid;border-right: 1px solid;transform: rotate(135deg);}
  #selectSearch:hover .after-content {position: absolute;right: 10px;top: 18px;width: 5px;height: 5px;border-top: 1px solid;border-right: 1px solid;transform: rotate(-45deg);}
  #selectSearch .selectSearch-btn {width: 100%;height: 36px;line-height: 36px;padding-left: 20px;border-right: solid 1px #e5e5e5;box-sizing: border-box;}
  #selectSearch:hover {background-color: white;}
  .selectSearch-btn:hover {background-color: #f2f2f2;}
  #selectSearch.hover {height: auto;}
</style>
<div id="header" data-spm="a2226n0">
      <div class="headerLayout">
        <div class="headerCon">
          <h1 id="mallLogo">
            <span class="mlogo">
              <a href="/">
                <s>
                </s>统采 Tc.com</a>
            </span>
          </h1>
          <div class="header-extra" style="overflow: visible;">
            <div class="header-logo">
              <a href="/">
              <img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/pc/img/pc/logo.gif" alt="">
              </a>
            </div>
            <div class="header-banner"></div>
            <div id="mallSearch" class="mall-search" style="overflow: visible;">
              <form name="searchTop" action="/search_all" class="mallSearch-form clearfix" target="_top" acceptcharset="gbk">
                <fieldset>
                  <legend>统采搜索</legend>
                  <div class="mallSearch-input clearfix">
                    <label for="mq">搜索 统采 商品/品牌/店铺</label>
                    <div class="s-combobox">
                      <div class="s-combobox-input-wrap" style="position: relative;padding-left: 70px;">
                        <div id="selectSearch">
                          {{if .searchType}}
                          <div class="selectSearch-btn" searchType='{{if eq .searchType "1"}}1{{else}}2{{end}}'>{{if eq .searchType "1"}}商品{{else}}店铺{{end}}</div>
                          <div class="selectSearch-btn" searchType='{{if eq .searchType "1"}}2{{else}}1{{end}}'>{{if eq .searchType "1"}}店铺{{else}}商品{{end}}</div>
                          {{else}}
                          <div class="selectSearch-btn" searchType='1'>商品</div>
                          <div class="selectSearch-btn" searchType='2'>店铺</div>
                          {{end}}
                          <div class="after-content"></div>
                        </div>
                        <input type="text" name="search" accesskey="s" placeholder="搜索 统采 商品/品牌/店铺" autocomplete="off" x-webkit-speech="" x-webkit-grammar="builtin:translate" value="{{.search}}" id="mq">
                        {{if .searchType}}
                        <input type="hidden" name="type" id="searchType" value='{{if eq .searchType "1"}}1{{else}}2{{end}}'>
                        {{else}}
                        <input type="hidden" name="type" id="searchType" value="1">
                        {{end}}
                      </div>
                    </div>
                    <button style="z-index: 3;" type="submit">搜索
                      <s></s>
                    </button>
<!--                     <input id="J_Type" type="hidden" name="type" value="p">
                    <input id="J_MallSearchStyle" type="hidden" name="style" value="">
                    <input id="J_Cat" type="hidden" name="cat" value="all">
                    <input type="hidden" name="vmarket" value=""></div> -->
                </fieldset>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
    <script type="text/javascript">
      var selectSearch = document.getElementById('selectSearch')
      selectSearch.addEventListener('click', function (e) {
        var target = e.target
        var firstElement = selectSearch.firstElementChild
        if (target == firstElement || target == selectSearch.lastElementChild) {
          return
        }
        var type = target.getAttribute('searchType')
        document.getElementById('searchType').value = type
        document.getElementById('mq').focus()
        selectSearch.insertBefore(target, firstElement)
        this.className = ""
      })
      selectSearch.onmouseenter = function () {
        this.className = "hover"
        this.getElementsByClassName('selectSearch-btn')[0].style.border = 'none'
        this.getElementsByClassName('selectSearch-btn')[0].style.borderRight = '1px solid #e5e5e5'        
        this.getElementsByClassName('selectSearch-btn')[1].style.border = '1px solid #e5e5e5'  
        this.getElementsByClassName('selectSearch-btn')[1].style.borderTop = 'none'
      }
      selectSearch.onmouseleave = function () {
        this.className = ""
      }
    </script>